package com.noahplat.person.pojo;


import lombok.Data;
import org.hibernate.validator.constraints.Length;
import tk.mybatis.mapper.annotation.KeySql;

import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * 功能：人员基本信息实体类
 * name:宋彦磊
 * time:2021.02.28
 */

@Data
@Table(name = "tb_person_info")
public class PersonInfo implements Serializable {
    @Id
    @KeySql(useGeneratedKeys = true)
    private Long id;   //主键ID
    private Long pid;  //人员ID

    @NotNull(message = "姓名不能为空")
    @Length(max = 32)
    private String name; //姓名

    @NotNull(message = "身份证号不能为空")
    @Length(max = 32)
    private String card;  //身份证号

    @NotNull(message = "家庭住址不能为空")
    @Length(max = 128)
    private String address;  //家庭住址

    @NotNull(message = "联系电话不能为空")
    @Length(max = 32)
    private String phone;  //联系电话

    @NotNull(message = "QQ账号不能为空")
    @Length(max = 32)
    private String qqno;  //QQ账号

    @NotNull(message = "微信账号不能为空")
    @Length(max = 32)
    private String wxno;  //微信账号

    @NotNull(message = "邮箱不能为空")
    @Length(max = 32)
    private String email;  //邮箱

    @NotNull(message = "紧急联系人姓名不能为空")
    @Length(max = 32)
    private String cname;  //紧急联系人姓名

    @NotNull(message = "紧急联系人电话不能为空")
    @Length(max = 32)
    private String cphone;  //紧急联系人电话

    @NotNull(message = "紧急联系人地址不能为空")
    @Length(max = 128)
    private String caddress;  //紧急联系人地址

    @NotNull(message = "紧急联系人QQ账号不能为空")
    @Length(max = 32)
    private String cqqno;  //紧急联系人QQ账号

    @NotNull(message = "紧急联系人微信不能为空")
    @Length(max = 32)
    private String cwxno;  //紧急联系人微信

    @NotNull(message = "紧急联系人邮箱不能为空")
    @Length(max = 32)
    private String cemail;  //紧急联系人邮箱

    @Transient
    private Long personid;  //人员表ID
    @Transient
    private String no;     //人员编号
    @Transient
    private Long acctid;     //人员编号
    @Transient
    private Long userid;     //人员编号

    /**
     * 重写无参构造
     */
    public PersonInfo() {
    }

    /**
     * 重写有参构造
     * @param pid
     * @param name
     * @param card
     * @param address
     * @param phone
     * @param qqno
     * @param wxno
     * @param email
     * @param cname
     * @param cphone
     * @param caddress
     * @param cqqno
     * @param cwxno
     * @param cemail
     */
    public PersonInfo(Long pid, @NotNull(message = "参数不能为null") @Length(max = 32) String name, @NotNull(message = "参数不能为null") @Length(max = 32) String card, @NotNull(message = "参数不能为null") @Length(max = 128) String address, @NotNull(message = "参数不能为null") @Length(max = 32) String phone, @NotNull(message = "参数不能为null") @Length(max = 32) String qqno, @NotNull(message = "参数不能为null") @Length(max = 32) String wxno, @NotNull(message = "参数不能为null") @Length(max = 32) String email, @NotNull(message = "参数不能为null") @Length(max = 32) String cname, @NotNull(message = "参数不能为null") @Length(max = 32) String cphone, @NotNull(message = "参数不能为null") @Length(max = 128) String caddress, @NotNull(message = "参数不能为null") @Length(max = 32) String cqqno, @NotNull(message = "参数不能为null") @Length(max = 32) String cwxno, @NotNull(message = "参数不能为null") @Length(max = 32) String cemail) {
        this.pid = pid;
        this.name = name;
        this.card = card;
        this.address = address;
        this.phone = phone;
        this.qqno = qqno;
        this.wxno = wxno;
        this.email = email;
        this.cname = cname;
        this.cphone = cphone;
        this.caddress = caddress;
        this.cqqno = cqqno;
        this.cwxno = cwxno;
        this.cemail = cemail;
    }
}
